package com.entrogy.service;

import com.alibaba.fastjson.JSONObject;
import com.entrogy.bean.*;

import java.util.List;

/**
 * @Author 罗兴江
 * @date 2019/5/31 0025 上午 10:54
 * 考试管理 服务层
 */
public interface ExamService {

    List<ExamEntity> findExamList(String userId, Integer schoolCode, Integer examId);

    Integer addExam(ExamEntity examEntity);

    List<SimpleExamEntity> findSimpleExamList(Integer gradeId, String teacherId, Integer schoolCode);

    List<GradeEntity> findExamGradeByClassIds(List<Integer> examClassIds, Integer examId);

    String findScoreTableNameByExamId(Integer examId);

    List<SimpleExamEntity> findExamListByStuId(Integer stuId);

    List<SimpleExamEntity> findSimpleExamListByGradeIdOrUid(String gradeId, String uId, Integer schoolCode);

    /**
     * 查找此次考试的班级
     * @param examId
     * @return
     */
    List<Integer> listExamClassId(Integer examId);

//    List<SimpleExamEntity> findExamListByPosition(Integer gradeId, String teacherId, Integer schoolCode, boolean isClassLeader);

    List<SimpleExamEntity> listSchoolExam(Integer schoolCode, String examName, String examTime);

    boolean deleteExam(Integer examId);

    List<SimpleExamEntity> listExamForCourseTeacher(String teacherId);

    int countExam(Integer schoolCode);

    Integer countExamStudent(Integer examId);

    /**
     * 查询此次考试的所有班级
     * @param examId
     * @return
     */
    List<ClassEntity> listExamClass(Integer examId);

    /**
     * 查询家长能够看哪些考试（自己的孩子的）
     *
     * @param uId
     * @param examName
     * @param examTime
     * @return
     */
    List<SimpleExamEntity> listExamForParent(String uId, String examName, String examTime);

    /**
     * 查看考试的科目
     * @param examId
     * @return
     */
    List<CourseEntity> listExamCourse(Integer examId);

    /**
     * 插入考试的排名生成记录
     * @param examId
     * @param requireCourseClassRank
     * @param requireCourseGradeRank
     * @param requireTotalScoreClassRank
     * @param requireTotalScoreGradeRank
     * @param requireScienceOrArtsClassRank
     * @param requireScienceOrArtsGradeRank
     * @param requireClassAvgScore
     * @param requireGradeAvgScore
     * @return
     */
    boolean insertRankGenerateRecord(Integer examId, Integer requireCourseClassRank, Integer requireCourseGradeRank, Integer requireTotalScoreClassRank, Integer requireTotalScoreGradeRank, Integer requireScienceOrArtsClassRank, Integer requireScienceOrArtsGradeRank, Integer requireClassAvgScore, Integer requireGradeAvgScore);

    /**
     * 删除考试的排名生成记录
     * @param examId
     * @return
     */
    int deleteRankGenerateRecord(Integer examId);

    /**
     * 查询该次考试的排名生成情况用于前端动态显示排名情况
     * @param examId
     * @return
     */
    JSONObject getRankGenerateRecord(Integer examId);

    /**
     * 初始化该次考试的所有排名信息
     * @param examId
     * @param scoreTableName
     * @return
     */
    boolean initExamRank(Integer examId, String scoreTableName);
}
